﻿using System.Data;

namespace Light.Framework
{
    /// <summary>
    /// 数据字段信息：来自属性的ColumnAttribute 特性
    /// </summary>
    public class ColumnInfo
    {
        public ColumnInfo()
        {
            Type = DbType.Object;
        }

        /// <summary>
        /// 对应的属性名
        /// </summary>
        public string PropertyName { get; set; }

        /// <summary>
        /// 数据库字段名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 数据库类型
        /// </summary>
        public DbType Type { get; set; }

        /// <summary>
        /// 数据长度
        /// </summary>
        public int Size { get; set; }

        /// <summary>
        /// Column为主键时，未新增至数据库时的值
        /// </summary>
        internal string UnsavedValue { get; set; }

        /// <summary>
        /// 是否只用于查询，不保存此值
        /// </summary>
        public bool ReadOnly { get; set; }

        /// <summary>
        /// 是否为自增列
        /// </summary>
        public bool IsAutoIncrement { get; set; }
    }
}
